use "gtrend_combined.dta", replace 
set scheme plotplain

encode country, generate(ctry)
tsset ctry date


* Brazil
graph twoway tsline search if ctry==1, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(28oct2018, lcolor(black) lpattern("l")) ///
	tline(7oct2018, lcolor(gs5) lpattern("shortdash")) ///
	tlabel(28sep2018 28oct2018 27nov2018,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Jair Bolsonaro", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry1, replace)
	
* India
graph twoway tsline search if ctry==2, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(1jun2024, lcolor(black) lpattern("l")) ///
	tlabel(2may2024 1jun2024 1july2024,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Narendra Modi", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry2, replace)

* Philippines
graph twoway tsline search if ctry==3, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(9may2016, lcolor(black) lpattern("l")) ///
	tlabel(9apr2016 9may2016 8jun2016,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Rodrigo Duterte", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry3, replace)


* Turkey
graph twoway tsline search if ctry==4, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(28may2023, lcolor(black) lpattern("l")) ///
	tline(14may2023, lcolor(gs5) lpattern("shortdash")) ///
	tlabel(28apr2023 28may2023 27jun2023,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Recep Tayyip Erdoğan", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry4, replace)	
	
* US
graph twoway tsline search if ctry==5, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(8nov2016, lcolor(black) lpattern("l")) ///
	tlabel(9oct2016 8nov2016 8dec2016,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Donald Trump", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry5, replace)	

* Venzezuela
graph twoway tsline search if ctry==6, ///
	lcolor("220 20 60") lpattern("l") ylabel(0(20)100, nogrid labsize(2)) ///
	tline(20may2018, lcolor(black) lpattern("l")) ///
	tlabel(20apr2018 20may2018 19jun2018,  labsize(3) format(%tdDD-Mon-CCYY)) 	/// 
	ytitle(" ", size(3.0)) ylabel(, labsize(med)) xtitle("Date", size(3.0)) ///
	title("Nicolás Maduro", size(4.7)) /// 
	legend(off) graphregion(margin(r+5)) scheme(plotplain) ///
	saving(ctry6, replace)	
	
	
graph combine ctry1.gph ctry2.gph ctry3.gph ctry4.gph ctry5.gph ctry6.gph, title(" ")  graphregion(margin(zero))
graph export "gtrend.png", replace		

